<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>Dissasemble: src/process/decode/decode.c Source File</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>

</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  <td id="projectlogo"><img alt="Logo" src="Hopper_v3.png"/></td>
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">Dissasemble
   &#160;<span id="projectnumber">1.0</span>
   </div>
   <div id="projectbrief">This project receives as input a file.o and displays the assembly code for that object.</div>
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.6.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>Globals</span></a></li>
    </ul>
  </div>
</div>
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
  initNavTree('decode_8c.html','');
</script>
<div id="doc-content">
<div class="header">
  <div class="headertitle">
<div class="title">src/process/decode/decode.c</div>  </div>
</div><!--header-->
<div class="contents">
<a href="decode_8c.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
<a name="l00002"></a>00002 <span class="comment"> ============================================================================</span>
<a name="l00003"></a>00003 <span class="comment"> Name        : decode.c</span>
<a name="l00004"></a>00004 <span class="comment"> Author      :</span>
<a name="l00005"></a>00005 <span class="comment"> Version     :  1</span>
<a name="l00006"></a>00006 <span class="comment"> Copyright   : Your copyright notice</span>
<a name="l00007"></a>00007 <span class="comment"> Description :  Perform properly disassembly process. Identifies if the byte analyzed</span>
<a name="l00008"></a>00008 <span class="comment">  corresponds to a prefix, opcode, or is a record, use the information provided by</span>
<a name="l00009"></a>00009 <span class="comment">  the XML file for this analysis</span>
<a name="l00010"></a>00010 <span class="comment"> ============================================================================</span>
<a name="l00011"></a>00011 <span class="comment"> */</span>
<a name="l00012"></a>00012 
<a name="l00013"></a>00013 <span class="preprocessor">#include &quot;<a class="code" href="decode_8h.html">decode.h</a>&quot;</span>
<a name="l00014"></a>00014 <span class="preprocessor">#include &lt;<a class="code" href="common_8h.html">common.h</a>&gt;</span>
<a name="l00015"></a>00015 <span class="preprocessor">#include &lt;<a class="code" href="my_lib_8h.html">myLib.h</a>&gt;</span>
<a name="l00016"></a>00016 <span class="preprocessor">#include &quot;<a class="code" href="ins_parser_8h.html">process/instructionRefParser/insParser.h</a>&quot;</span>
<a name="l00017"></a>00017 
<a name="l00018"></a><a class="code" href="decode_8c.html#a434fe20f31a4c47e314f8326f6a31d21">00018</a> <a class="code" href="common_8h.html#a7e125472d65b57f10905accbed140b99" title="Stores 8 bits.">INT8</a> * <a class="code" href="decode_8c.html#a434fe20f31a4c47e314f8326f6a31d21" title="Global Buffer containing the instruction to be processed.">gBuf</a>; 
<a name="l00019"></a><a class="code" href="decode_8c.html#a513933770d2ecd9754fbb67a790bdb45">00019</a> <a class="code" href="common_8h.html#a69afa2e50b905f4eab1f2df8a3fd9f23" title="One instruction.">UINT32</a> <a class="code" href="decode_8c.html#a513933770d2ecd9754fbb67a790bdb45" title="Address to be access.">gAddress</a> = 0; 
<a name="l00020"></a>00020 
<a name="l00021"></a>00021 <span class="keywordtype">char</span> <a class="code" href="decode_8c.html#af43580ec538f6fc237691eb3a926a93d" title="Function that determines the processing functionality byte.">determineByteFunction</a>(<span class="keywordtype">char</span>* buf);
<a name="l00025"></a><a class="code" href="struct_c_o_d_e___f_o_r___o_p___t_y_p_e.html">00025</a> <span class="keyword">typedef</span> <span class="keyword">struct</span>
<a name="l00027"></a>00027 {
<a name="l00028"></a><a class="code" href="struct_c_o_d_e___f_o_r___o_p___t_y_p_e.html#a4facf4f9894d67cc979d8e5a03ea24b3">00028</a>         <a class="code" href="common_8h.html#a7e125472d65b57f10905accbed140b99" title="Stores 8 bits.">INT8</a> code[5]; 
<a name="l00029"></a><a class="code" href="struct_c_o_d_e___f_o_r___o_p___t_y_p_e.html#a0f4fd87469412eb48c120bd1492f7b85">00029</a>         <a class="code" href="common_8h.html#aac92c5ec332dafe0abb24688dad1b795" title="Stores 32 bits.">INT32</a> <a class="code" href="my_obj_dump_8c.html#a1e1268d164c38e4f8a4f4eb9058b0601" title="File size.">size</a>[3]; 
<a name="l00030"></a><a class="code" href="struct_c_o_d_e___f_o_r___o_p___t_y_p_e.html#a8bab6aa7cec12da5156fcc0b5bed4993">00030</a>         <a class="code" href="common_8h.html#ad8ce12d83f204245685f98caf9d03944" title="One byte.">UINT8</a> <a class="code" href="struct_c_o_d_e___f_o_r___o_p___t_y_p_e.html#a8bab6aa7cec12da5156fcc0b5bed4993">wtf</a>;
<a name="l00031"></a>00031 } <a class="code" href="struct_c_o_d_e___f_o_r___o_p___t_y_p_e.html" title="Structure containing the code and size of an operation according its type.">CODE_FOR_OP_TYPE</a>;
<a name="l00032"></a>00032 
<a name="l00036"></a><a class="code" href="structs___addressing_method.html">00036</a> <span class="keyword">typedef</span> <span class="keyword">struct</span>
<a name="l00038"></a>00038 {
<a name="l00039"></a><a class="code" href="structs___addressing_method.html#a4d58f38b3056254422336aef75298811">00039</a>         <a class="code" href="common_8h.html#a7e125472d65b57f10905accbed140b99" title="Stores 8 bits.">INT8</a> coder[3]; 
<a name="l00040"></a><a class="code" href="structs___addressing_method.html#af26aab29c7050e74dc537fb2ff88f34a">00040</a>         <a class="code" href="common_8h.html#ad8ce12d83f204245685f98caf9d03944" title="One byte.">UINT8</a> <a class="code" href="structs___addressing_method.html#af26aab29c7050e74dc537fb2ff88f34a" title="Size of ModReg register.">isSizeInModreg</a>; 
<a name="l00041"></a><a class="code" href="structs___addressing_method.html#a287348bf234d6dd4a62e7a726c6ad4cf">00041</a>         <a class="code" href="common_8h.html#ad8ce12d83f204245685f98caf9d03944" title="One byte.">UINT8</a> <a class="code" href="structs___addressing_method.html#a287348bf234d6dd4a62e7a726c6ad4cf" title="Size of addressing.">sizeOfAddressing</a>;
<a name="l00042"></a><a class="code" href="structs___addressing_method.html#aa513d4ba82ded1b3a7031598dee4f96a">00042</a>         char (*func)(void);     
<a name="l00043"></a><a class="code" href="structs___addressing_method.html#a8bab6aa7cec12da5156fcc0b5bed4993">00043</a>         <a class="code" href="common_8h.html#ad8ce12d83f204245685f98caf9d03944" title="One byte.">UINT8</a> <a class="code" href="structs___addressing_method.html#a8bab6aa7cec12da5156fcc0b5bed4993">wtf</a>;
<a name="l00044"></a>00044 } <a class="code" href="structs___addressing_method.html" title="Structure containing the Addressing method of an operation.">s_AddressingMethod</a>;
<a name="l00045"></a>00045 
<a name="l00046"></a>00046 
<a name="l00047"></a><a class="code" href="decode_8c.html#a815b93624003eeec418bd4d3da2bf2ef">00047</a> <a class="code" href="structs___addressing_method.html" title="Structure containing the Addressing method of an operation.">s_AddressingMethod</a> <a class="code" href="decode_8c.html#a815b93624003eeec418bd4d3da2bf2ef" title="Array of addressing methods available.">AddresingMethodList</a>[] = 
<a name="l00048"></a>00048 {
<a name="l00049"></a>00049                 { <span class="stringliteral">&quot;Z&quot;</span>, 1, 0, 0, 0 }, <span class="comment">// Addd fuction to get the 3 lsb and know the register.</span>
<a name="l00050"></a>00050                 { <span class="stringliteral">&quot;E&quot;</span>, 1, 4, 0, 0 }, <span class="comment">//should be 3</span>
<a name="l00051"></a>00051                 { <span class="stringliteral">&quot;G&quot;</span>, 1, 4, 0, 0 }, <span class="comment">//should be 3</span>
<a name="l00052"></a>00052                 { <span class="stringliteral">&quot;I&quot;</span>, 0, 0, 0, 0 }, <span class="comment">//should be 3</span>
<a name="l00053"></a>00053                 { <span class="stringliteral">&quot;A&quot;</span>, 0, 0, 0, 1 }, <span class="comment">//Direct address. The instruction has no ModR/M byte;</span>
<a name="l00054"></a>00054                 { <span class="stringliteral">&quot;BA&quot;</span>, 0, 0, 0, 1 }, <span class="comment">//Memory addressed by DS:EAX, or by rAX in 64-bit mode</span>
<a name="l00055"></a>00055                 { <span class="stringliteral">&quot;BB&quot;</span>, 0, 0, 0, 1 }, <span class="comment">//Memory addressed by DS:eBX+AL, or by rBX+AL in 64-bit mode</span>
<a name="l00056"></a>00056                 { <span class="stringliteral">&quot;BD&quot;</span>, 0, 0, 0, 1 }, <span class="comment">//Memory addressed by DS:eDI or by RDI</span>
<a name="l00057"></a>00057                 { <span class="stringliteral">&quot;C&quot;</span>, 0, 0, 0, 1 }, <span class="comment">//The reg field of the ModR/M byte selects a control register</span>
<a name="l00058"></a>00058                 { <span class="stringliteral">&quot;D&quot;</span>, 0, 0, 0, 1 }, <span class="comment">//The reg field of the ModR/M byte selects a debug register</span>
<a name="l00059"></a>00059                 { <span class="stringliteral">&quot;ES&quot;</span>, 0, 0, 0, 1 }, <span class="comment">//A ModR/M byte follows the opcode and specifies the operand.</span>
<a name="l00060"></a>00060                 { <span class="stringliteral">&quot;EST&quot;</span>, 0, 0, 0, 1 }, <span class="comment">//A ModR/M byte follows the opcode and specifies the x87 FPU stack register.</span>
<a name="l00061"></a>00061                 { <span class="stringliteral">&quot;F&quot;</span>, 1, 0, 0, 1 }, <span class="comment">//rFLAGS register.</span>
<a name="l00062"></a>00062                 { <span class="stringliteral">&quot;H&quot;</span>, 0, 0, 0, 1 }, <span class="comment">//The r/m field of the ModR/M byte always selects a general register,</span>
<a name="l00063"></a>00063                 { <span class="stringliteral">&quot;J&quot;</span>, 1, 0, 0, 1 }, <span class="comment">//The instruction contains a relative offset to be added to the instruction pointer register (for example, JMP (E9), LOOP)).</span>
<a name="l00064"></a>00064                 { <span class="stringliteral">&quot;M&quot;</span>, 0, 0, 0, 1 }, <span class="comment">//The ModR/M byte may refer only to memory</span>
<a name="l00065"></a>00065                 { <span class="stringliteral">&quot;N&quot;</span>, 0, 0, 0, 1 }, <span class="comment">//The R/M field of the ModR/M byte selects a packed quadword MMX technology register.</span>
<a name="l00066"></a>00066                 { <span class="stringliteral">&quot;O&quot;</span>, 1, 0, 0, 1 }, <span class="comment">//The instruction has no ModR/M byte;</span>
<a name="l00067"></a>00067                 { <span class="stringliteral">&quot;P&quot;</span>, 0, 0, 0, 1 }, <span class="comment">//The reg field of the ModR/M byte selects a packed quadword MMX technology register.</span>
<a name="l00068"></a>00068                 { <span class="stringliteral">&quot;Q&quot;</span>, 0, 0, 0, 1 }, <span class="comment">//A ModR/M byte follows the opcode and specifies the operand.</span>
<a name="l00069"></a>00069                 { <span class="stringliteral">&quot;R&quot;</span>, 1, 4, 0, 1 }, <span class="comment">//The mod field of the ModR/M byte may refer only to a general register</span>
<a name="l00070"></a>00070                 { <span class="stringliteral">&quot;S&quot;</span>, 0, 0, 0, 1 }, <span class="comment">//The reg field of the ModR/M byte selects a segment register</span>
<a name="l00071"></a>00071                 { <span class="stringliteral">&quot;SC&quot;</span>, 1, 0, 0, 1 }, <span class="comment">//Stack operand,</span>
<a name="l00072"></a>00072                 { <span class="stringliteral">&quot;T&quot;</span>, 1, 4, 0, 1 }, <span class="comment">//The reg field of the ModR/M byte selects a test register</span>
<a name="l00073"></a>00073                 { <span class="stringliteral">&quot;U&quot;</span>, 1, 128, 0, 1 }, <span class="comment">//The R/M field of the ModR/M byte selects a 128-bit XMM register.</span>
<a name="l00074"></a>00074                 { <span class="stringliteral">&quot;V&quot;</span>, 1, 128, 0, 1 }, <span class="comment">//The reg field of the ModR/M byte selects a 128-bit XMM register.</span>
<a name="l00075"></a>00075                 { <span class="stringliteral">&quot;W&quot;</span>, 0, 0, 0, 1 }, <span class="comment">//A ModR/M byte follows the opcode and specifies the operand. {&quot;X&quot;,1,0,0},//Memory addressed by the DS:eSI or by RSI</span>
<a name="l00076"></a>00076                 { <span class="stringliteral">&quot;Y&quot;</span>, 0, 0, 0, 1 }, <span class="comment">//Memory addressed by the ES:eDI or by RDI</span>
<a name="l00077"></a>00077                 { <span class="stringliteral">&quot;H1&quot;</span>, 1, 0, 0, 1 }, <span class="comment">//Memory addressed by the ES:eDI or by RDI</span>
<a name="l00078"></a>00078                 { <span class="stringliteral">&quot;\0&quot;</span>, 0, 0, 0, 0 },
<a name="l00079"></a>00079                 };
<a name="l00083"></a><a class="code" href="structs___prefix_descriptor.html">00083</a> <span class="keyword">typedef</span> <span class="keyword">struct</span>
<a name="l00085"></a>00085 {
<a name="l00086"></a><a class="code" href="structs___prefix_descriptor.html#acc9f4f4f6caf29069dbe5bcafd18426a">00086</a>         <a class="code" href="common_8h.html#ad8ce12d83f204245685f98caf9d03944" title="One byte.">UINT8</a> <a class="code" href="structs___prefix_descriptor.html#acc9f4f4f6caf29069dbe5bcafd18426a" title="Prefix values.">prefixValue</a>; 
<a name="l00087"></a><a class="code" href="structs___prefix_descriptor.html#ac86594fb76193cdd5825e2a13c09f1bd">00087</a>         <a class="code" href="common_8h.html#ad8ce12d83f204245685f98caf9d03944" title="One byte.">UINT8</a> <a class="code" href="structs___prefix_descriptor.html#ac86594fb76193cdd5825e2a13c09f1bd" title="Prefix size.">size</a>; 
<a name="l00088"></a><a class="code" href="structs___prefix_descriptor.html#a8bab6aa7cec12da5156fcc0b5bed4993">00088</a>         <a class="code" href="common_8h.html#ad8ce12d83f204245685f98caf9d03944" title="One byte.">UINT8</a> <a class="code" href="structs___prefix_descriptor.html#a8bab6aa7cec12da5156fcc0b5bed4993">wtf</a>;
<a name="l00089"></a>00089 <span class="comment">//...</span>
<a name="l00090"></a>00090 } <a class="code" href="structs___prefix_descriptor.html" title="Structure containing the prefixes to be identified within a statement.">s_PrefixDescriptor</a>;
<a name="l00091"></a>00091 
<a name="l00092"></a><a class="code" href="decode_8c.html#aa93c1548ecbcf7220917fcbefb596d5e">00092</a> <a class="code" href="structs___prefix_descriptor.html" title="Structure containing the prefixes to be identified within a statement.">s_PrefixDescriptor</a> <a class="code" href="decode_8c.html#aa93c1548ecbcf7220917fcbefb596d5e" title="Array of prefix options.">PrefixDescriptionList</a>[] = 
<a name="l00093"></a>00093 {
<a name="l00094"></a>00094                 { 0x66, 1, 0 }, <span class="comment">//complete</span>
<a name="l00095"></a>00095                 { 0x26, 1, 1 }, <span class="comment">//null prefix in 64 mode</span>
<a name="l00096"></a>00096                 { 0x2E, 1, 1 }, <span class="comment">//null prefix in 64 mode</span>
<a name="l00097"></a>00097                 { 0x36, 1, 1 }, <span class="comment">//null prefix in 64 mode</span>
<a name="l00098"></a>00098                 { 0x3E, 1.1 }, <span class="comment">//null prefix in 64 mode</span>
<a name="l00099"></a>00099                 { 0x40, 1, 0 }, <span class="comment">//todo check how this prefix works</span>
<a name="l00100"></a>00100                 { 0x41, 1, 1 }, <span class="comment">//Extension of r/m field, base field, or opcode reg field</span>
<a name="l00101"></a>00101                 { 0x42, 1, 1 }, <span class="comment">//Extension of SIB index field</span>
<a name="l00102"></a>00102                 { 0x43, 1, 1 }, <span class="comment">//REX.X and REX.B combination</span>
<a name="l00103"></a>00103                 { 0x44, 1, 1 }, <span class="comment">//Extension of ModR/M reg field</span>
<a name="l00104"></a>00104                 { 0x45, 1, 1 }, <span class="comment">//REX.R and REX.B combination</span>
<a name="l00105"></a>00105                 { 0x46, 1, 1 }, <span class="comment">//REX.R and REX.X combination</span>
<a name="l00106"></a>00106                 { 0x47, 1, 1 }, <span class="comment">//REX.R, REX.X and REX.B combination</span>
<a name="l00107"></a>00107                 { 0x48, 2, 0 },
<a name="l00108"></a>00108                 { 0x49, 1, 1 }, <span class="comment">//REX.W and REX.B combination</span>
<a name="l00109"></a>00109                 { 0x4A, 1, 1 }, <span class="comment">//REX.W and REX.X combination</span>
<a name="l00110"></a>00110                 { 0x4B, 1, 1 }, <span class="comment">// REX.X and REX.B combination</span>
<a name="l00111"></a>00111                 { 0x4C, 1, 1 }, <span class="comment">//REX.W and REX.R combination</span>
<a name="l00112"></a>00112                 { 0x4D, 1, 1 }, <span class="comment">//REX.W, REX.R and REX.B combination</span>
<a name="l00113"></a>00113                 { 0x4E, 1, 1 }, <span class="comment">//REX.W, REX.R and REX.X combination</span>
<a name="l00114"></a>00114                 { 0x4F, 1, 1 }, <span class="comment">//REX.W, REX.R, REX.X and REX.B combination</span>
<a name="l00115"></a>00115                 { 0x64, 1, 1 }, <span class="comment">//FS segment override prefix</span>
<a name="l00116"></a>00116                 { 0x65, 1, 1 }, <span class="comment">//GS segment override prefix</span>
<a name="l00117"></a>00117                 { 0x66, 1, 1 }, <span class="comment">//Operand-size override prefix</span>
<a name="l00118"></a>00118                 { 0x66, 1, 1 }, <span class="comment">//Precision-size override prefix</span>
<a name="l00119"></a>00119                 { 0x67, 1, 1 }, <span class="comment">//Address-size override prefix</span>
<a name="l00120"></a>00120                 { 0x9B, 1, 1 }, <span class="comment">//Wait Prefix</span>
<a name="l00121"></a>00121                 { 0xF0, 1, 1 }, <span class="comment">//Assert LOCK# Signal Prefix</span>
<a name="l00122"></a>00122                 { 0xF2, 1, 1 }, <span class="comment">//Repeat String Operation Prefix (different cases)</span>
<a name="l00123"></a>00123                 { 0xF3, 1, 1 }, <span class="comment">//Repeat String Operation Prefix (different cases)</span>
<a name="l00124"></a>00124                 { 0, 0, 0 },
<a name="l00125"></a>00125 };
<a name="l00126"></a>00126 
<a name="l00127"></a><a class="code" href="decode_8c.html#a2c6bbca72cf3a579cdad52052a3ab14e">00127</a> <a class="code" href="struct__reg__values.html" title="Structure containing the attributes of the different types of records.">REG_VALUES</a> <a class="code" href="decode_8c.html#a2c6bbca72cf3a579cdad52052a3ab14e" title="Array containing the different record types according to their size.">reg_values_list</a>[] = 
<a name="l00128"></a>00128 {
<a name="l00129"></a>00129         { <span class="stringliteral">&quot;al &quot;</span>, 0, <a class="code" href="decode_8h.html#ab08a50ead6f11683035e8b03e9a6ab76a9639e22aeeea626bf1cfbdc8a464ee15">SIZE_8</a> },
<a name="l00130"></a>00130         { <span class="stringliteral">&quot;cl &quot;</span>, 1, <a class="code" href="decode_8h.html#ab08a50ead6f11683035e8b03e9a6ab76a9639e22aeeea626bf1cfbdc8a464ee15">SIZE_8</a> },
<a name="l00131"></a>00131         { <span class="stringliteral">&quot;dl &quot;</span>, 2, <a class="code" href="decode_8h.html#ab08a50ead6f11683035e8b03e9a6ab76a9639e22aeeea626bf1cfbdc8a464ee15">SIZE_8</a> },
<a name="l00132"></a>00132         { <span class="stringliteral">&quot;bl &quot;</span>, 3, <a class="code" href="decode_8h.html#ab08a50ead6f11683035e8b03e9a6ab76a9639e22aeeea626bf1cfbdc8a464ee15">SIZE_8</a> },
<a name="l00133"></a>00133         { <span class="stringliteral">&quot;ah &quot;</span>, 4, <a class="code" href="decode_8h.html#ab08a50ead6f11683035e8b03e9a6ab76a9639e22aeeea626bf1cfbdc8a464ee15">SIZE_8</a> },
<a name="l00134"></a>00134         { <span class="stringliteral">&quot;ch &quot;</span>, 5, <a class="code" href="decode_8h.html#ab08a50ead6f11683035e8b03e9a6ab76a9639e22aeeea626bf1cfbdc8a464ee15">SIZE_8</a> },
<a name="l00135"></a>00135         { <span class="stringliteral">&quot;dh &quot;</span>, 6, <a class="code" href="decode_8h.html#ab08a50ead6f11683035e8b03e9a6ab76a9639e22aeeea626bf1cfbdc8a464ee15">SIZE_8</a> },
<a name="l00136"></a>00136         { <span class="stringliteral">&quot;bh &quot;</span>, 7, <a class="code" href="decode_8h.html#ab08a50ead6f11683035e8b03e9a6ab76a9639e22aeeea626bf1cfbdc8a464ee15">SIZE_8</a> },
<a name="l00137"></a>00137 
<a name="l00138"></a>00138         { <span class="stringliteral">&quot;ax &quot;</span>, 0, <a class="code" href="decode_8h.html#ab08a50ead6f11683035e8b03e9a6ab76acaadd71d361a7b55bae5ab125e2485f3">SIZE_16</a> },
<a name="l00139"></a>00139         { <span class="stringliteral">&quot;cx &quot;</span>, 1, <a class="code" href="decode_8h.html#ab08a50ead6f11683035e8b03e9a6ab76acaadd71d361a7b55bae5ab125e2485f3">SIZE_16</a> },
<a name="l00140"></a>00140         { <span class="stringliteral">&quot;dx &quot;</span>, 2, <a class="code" href="decode_8h.html#ab08a50ead6f11683035e8b03e9a6ab76acaadd71d361a7b55bae5ab125e2485f3">SIZE_16</a> },
<a name="l00141"></a>00141         { <span class="stringliteral">&quot;bx &quot;</span>, 3, <a class="code" href="decode_8h.html#ab08a50ead6f11683035e8b03e9a6ab76acaadd71d361a7b55bae5ab125e2485f3">SIZE_16</a> },
<a name="l00142"></a>00142         { <span class="stringliteral">&quot;sp &quot;</span>, 4, <a class="code" href="decode_8h.html#ab08a50ead6f11683035e8b03e9a6ab76acaadd71d361a7b55bae5ab125e2485f3">SIZE_16</a> },
<a name="l00143"></a>00143         { <span class="stringliteral">&quot;bp &quot;</span>, 5, <a class="code" href="decode_8h.html#ab08a50ead6f11683035e8b03e9a6ab76acaadd71d361a7b55bae5ab125e2485f3">SIZE_16</a> },
<a name="l00144"></a>00144         { <span class="stringliteral">&quot;si &quot;</span>, 6, <a class="code" href="decode_8h.html#ab08a50ead6f11683035e8b03e9a6ab76acaadd71d361a7b55bae5ab125e2485f3">SIZE_16</a> },
<a name="l00145"></a>00145         { <span class="stringliteral">&quot;di &quot;</span>, 7, <a class="code" href="decode_8h.html#ab08a50ead6f11683035e8b03e9a6ab76acaadd71d361a7b55bae5ab125e2485f3">SIZE_16</a> },
<a name="l00146"></a>00146 
<a name="l00147"></a>00147         { <span class="stringliteral">&quot;eax&quot;</span>, 0, <a class="code" href="decode_8h.html#ab08a50ead6f11683035e8b03e9a6ab76af8c2bd7889de0704f869521c127f1749">SIZE_32</a> },
<a name="l00148"></a>00148         { <span class="stringliteral">&quot;ecx&quot;</span>, 1, <a class="code" href="decode_8h.html#ab08a50ead6f11683035e8b03e9a6ab76af8c2bd7889de0704f869521c127f1749">SIZE_32</a> },
<a name="l00149"></a>00149         { <span class="stringliteral">&quot;edx&quot;</span>, 2, <a class="code" href="decode_8h.html#ab08a50ead6f11683035e8b03e9a6ab76af8c2bd7889de0704f869521c127f1749">SIZE_32</a> },
<a name="l00150"></a>00150         { <span class="stringliteral">&quot;ebx&quot;</span>, 3, <a class="code" href="decode_8h.html#ab08a50ead6f11683035e8b03e9a6ab76af8c2bd7889de0704f869521c127f1749">SIZE_32</a> },
<a name="l00151"></a>00151         { <span class="stringliteral">&quot;esp&quot;</span>, 4, <a class="code" href="decode_8h.html#ab08a50ead6f11683035e8b03e9a6ab76af8c2bd7889de0704f869521c127f1749">SIZE_32</a> },
<a name="l00152"></a>00152         { <span class="stringliteral">&quot;ebp&quot;</span>, 5, <a class="code" href="decode_8h.html#ab08a50ead6f11683035e8b03e9a6ab76af8c2bd7889de0704f869521c127f1749">SIZE_32</a> },
<a name="l00153"></a>00153         { <span class="stringliteral">&quot;esi&quot;</span>, 6, <a class="code" href="decode_8h.html#ab08a50ead6f11683035e8b03e9a6ab76af8c2bd7889de0704f869521c127f1749">SIZE_32</a> },
<a name="l00154"></a>00154         { <span class="stringliteral">&quot;edi&quot;</span>, 7, <a class="code" href="decode_8h.html#ab08a50ead6f11683035e8b03e9a6ab76af8c2bd7889de0704f869521c127f1749">SIZE_32</a> },
<a name="l00155"></a>00155 
<a name="l00156"></a>00156         { 0, 0, 0 },
<a name="l00157"></a>00157 };
<a name="l00161"></a><a class="code" href="structs__decoding.html">00161</a> <span class="keyword">typedef</span> <span class="keyword">struct</span>
<a name="l00163"></a>00163 {
<a name="l00164"></a><a class="code" href="structs__decoding.html#a6c806f90f6c4ce6c5dd5e0dc786b40e8">00164</a>         <a class="code" href="struct_o_p_c_o_d_e___p_r_o_p_e_r_t_i_e_s.html" title="Properties of an operation code..">OPCODE_PROPERTIES</a> <a class="code" href="structs__decoding.html#a6c806f90f6c4ce6c5dd5e0dc786b40e8" title="Opcode properties.">opProperties</a>; 
<a name="l00165"></a><a class="code" href="structs__decoding.html#a2fd6616fee4654330b5c7b15da7b7352">00165</a>         <a class="code" href="struct___machine_inst_format.html" title="Machine Instruction Format.">MACHINE_INSTRUCTION</a> <a class="code" href="structs__decoding.html#a2fd6616fee4654330b5c7b15da7b7352" title="Instruction decoded.">instructionDecoded</a>; 
<a name="l00166"></a><a class="code" href="structs__decoding.html#a0afda97449e846ad8ced20300d67fe85">00166</a>         <a class="code" href="common_8h.html#ad8ce12d83f204245685f98caf9d03944" title="One byte.">UINT8</a> <a class="code" href="structs__decoding.html#a0afda97449e846ad8ced20300d67fe85" title="Instruction size.">instructionSize</a>; 
<a name="l00167"></a><a class="code" href="structs__decoding.html#a3c98d1c15bde6abca6b21ed1e3e40949">00167</a>         <a class="code" href="common_8h.html#ad8ce12d83f204245685f98caf9d03944" title="One byte.">UINT8</a> <a class="code" href="structs__decoding.html#a3c98d1c15bde6abca6b21ed1e3e40949">modRegRegisterNumber</a>; 
<a name="l00168"></a><a class="code" href="structs__decoding.html#a880d1b1b640377a292875a48b891f759">00168</a>         <a class="code" href="common_8h.html#ad8ce12d83f204245685f98caf9d03944" title="One byte.">UINT8</a> <a class="code" href="structs__decoding.html#a880d1b1b640377a292875a48b891f759" title="Prefix Size.">prefixSizeOverride</a>; 
<a name="l00169"></a><a class="code" href="structs__decoding.html#a588ec9ba2f9d51580c02d3b94a39c762">00169</a>         <a class="code" href="common_8h.html#ad8ce12d83f204245685f98caf9d03944" title="One byte.">UINT8</a> <a class="code" href="structs__decoding.html#a588ec9ba2f9d51580c02d3b94a39c762" title="Decoded value.">decoded</a>; 
<a name="l00170"></a><a class="code" href="structs__decoding.html#a40cb65954deb45d9dd6ced3b25376428">00170</a>         <a class="code" href="common_8h.html#ad8ce12d83f204245685f98caf9d03944" title="One byte.">UINT8</a> <a class="code" href="structs__decoding.html#a40cb65954deb45d9dd6ced3b25376428" title="Identifies if it is a ModReg register.">isModReg</a>; 
<a name="l00171"></a><a class="code" href="structs__decoding.html#a8fa14f6ccb49f5355858d25da0d59c91">00171</a>         <span class="keywordtype">char</span> instructionString[50]; 
<a name="l00172"></a><a class="code" href="structs__decoding.html#a3ba3c977f9f59cbdb48635e69c36c1e6">00172</a>         char (*Next)(<span class="keywordtype">char</span>*);
<a name="l00173"></a>00173 } <a class="code" href="structs__decoding.html" title="Structure containing information of a decoded instruction.">s_decoding</a>;
<a name="l00174"></a>00174 
<a name="l00175"></a><a class="code" href="decode_8c.html#a388828f2fe3264d3ff04dd759c45e3e7">00175</a> <a class="code" href="structs__decoding.html" title="Structure containing information of a decoded instruction.">s_decoding</a> <a class="code" href="decode_8c.html#a388828f2fe3264d3ff04dd759c45e3e7" title="State machine.">decodeMachine</a>; 
<a name="l00176"></a>00176 
<a name="l00177"></a><a class="code" href="decode_8c.html#a29379ff4587818005d5ef90dae5bd1e8">00177</a> <span class="keywordtype">char</span> <a class="code" href="decode_8c.html#a29379ff4587818005d5ef90dae5bd1e8" title="Array containing one byte instruction codes.">OneByteExtensionInstructions</a>[] = 
<a name="l00178"></a>00178 { 0x50, 0x58, 0x90, 0xb0, 0xb8, <span class="charliteral">&#39;\0&#39;</span> };
<a name="l00179"></a>00179 
<a name="l00180"></a><a class="code" href="decode_8c.html#acc808ea0dbac196a90bb83ea709f16a1">00180</a> <span class="keywordtype">char</span> <a class="code" href="decode_8c.html#acc808ea0dbac196a90bb83ea709f16a1" title="Array containing one byte instruction codes.">TwoByteExtensionInstructions</a>[] = 
<a name="l00181"></a>00181 { 0xc8 };
<a name="l00185"></a><a class="code" href="decode_8c.html#a419f00430cb5dcfe8a8955ae1635d448">00185</a> <span class="keywordtype">void</span> <a class="code" href="decode_8c.html#a419f00430cb5dcfe8a8955ae1635d448" title="The system is prepared to analyze the NEXT instruction.">prepareForNextInstruction</a>()
<a name="l00186"></a>00186 {
<a name="l00187"></a>00187 
<a name="l00188"></a>00188         <a class="code" href="decode_8c.html#a513933770d2ecd9754fbb67a790bdb45" title="Address to be access.">gAddress</a> += <a class="code" href="common_8h.html#a4aa5e2926d1ef8bcce281e0eab30025a" title="One byte in binary.">BIT2BYTE</a>(decodeMachine.<a class="code" href="structs__decoding.html#a0afda97449e846ad8ced20300d67fe85" title="Instruction size.">instructionSize</a>);
<a name="l00189"></a>00189         <a class="code" href="decode_8c.html#a434fe20f31a4c47e314f8326f6a31d21" title="Global Buffer containing the instruction to be processed.">gBuf</a> += <a class="code" href="common_8h.html#a4aa5e2926d1ef8bcce281e0eab30025a" title="One byte in binary.">BIT2BYTE</a>(decodeMachine.<a class="code" href="structs__decoding.html#a0afda97449e846ad8ced20300d67fe85" title="Instruction size.">instructionSize</a>);
<a name="l00190"></a>00190         decodeMachine.<a class="code" href="structs__decoding.html#a3ba3c977f9f59cbdb48635e69c36c1e6" title="Pointer to the next instruction.">Next</a> = 0;
<a name="l00191"></a>00191 
<a name="l00192"></a>00192 }
<a name="l00193"></a>00193 
<a name="l00194"></a><a class="code" href="decode_8c.html#ac525e2da5428fe38de67b0435b335da7">00194</a> <span class="keywordtype">char</span> <a class="code" href="decode_8c.html#ac525e2da5428fe38de67b0435b335da7">numberOfOperands</a>(<span class="keywordtype">char</span> opcode)
<a name="l00195"></a>00195 {
<a name="l00196"></a>00196 
<a name="l00197"></a>00197         <span class="keywordflow">return</span> 2;
<a name="l00198"></a>00198 }
<a name="l00199"></a>00199 
<a name="l00200"></a><a class="code" href="decode_8c.html#aad37bd4dc0860c7ea795072799faaff5">00200</a> <a class="code" href="common_8h.html#ad8ce12d83f204245685f98caf9d03944" title="One byte.">UINT8</a> <a class="code" href="decode_8c.html#aad37bd4dc0860c7ea795072799faaff5" title="Array containing the hexadecimal are not considered opcode.">noOpList</a>[] = 
<a name="l00201"></a>00201 { 0x50, 0x58, 0x90, 0xb0, 0xb8 };
<a name="l00206"></a><a class="code" href="decode_8c.html#a28978647f0e4c8eda225fa54b5ab2e75">00206</a> <a class="code" href="common_8h.html#ad8ce12d83f204245685f98caf9d03944" title="One byte.">UINT8</a> <a class="code" href="decode_8c.html#a28978647f0e4c8eda225fa54b5ab2e75" title="Verify that the operation code is not in the list of no operators.">isInNoOPList</a>(<a class="code" href="common_8h.html#ad8ce12d83f204245685f98caf9d03944" title="One byte.">UINT8</a> op)
<a name="l00207"></a>00207 {
<a name="l00208"></a>00208 <span class="comment">//      for(UINT8 x = 0; x&lt; 5; x++)</span>
<a name="l00209"></a>00209 <span class="comment">//      {</span>
<a name="l00210"></a>00210 <span class="comment">//              if(op==noOpList[x])</span>
<a name="l00211"></a>00211 <span class="comment">//                      return 1;</span>
<a name="l00212"></a>00212 <span class="comment">//      }</span>
<a name="l00213"></a>00213         <span class="keywordflow">return</span> 0;
<a name="l00214"></a>00214 }
<a name="l00215"></a>00215 
<a name="l00216"></a>00216 
<a name="l00217"></a><a class="code" href="decode_8c.html#ab9dafaeb644341185d2545f64b1b8d65">00217</a> <a class="code" href="struct_c_o_d_e___f_o_r___o_p___t_y_p_e.html" title="Structure containing the code and size of an operation according its type.">CODE_FOR_OP_TYPE</a> <a class="code" href="decode_8c.html#ab9dafaeb644341185d2545f64b1b8d65" title="Array containing the attributes of the different operand types.">operandTypeCodes</a>[] = 
<a name="l00218"></a>00218 {
<a name="l00219"></a>00219                 { <span class="stringliteral">&quot;a&quot;</span>,          { 32, -1, -1 }, 1 }, <span class="comment">//?</span>
<a name="l00220"></a>00220                 { <span class="stringliteral">&quot;b&quot;</span>,          { 8, -1, -1 }, 0 },
<a name="l00221"></a>00221                 { <span class="stringliteral">&quot;bcd&quot;</span>,        { 32, -1, -1 }, 1 }, <span class="comment">//?</span>
<a name="l00222"></a>00222                 { <span class="stringliteral">&quot;bs&quot;</span>,         { 8, -1, -1 }, 0 },
<a name="l00223"></a>00223                 { <span class="stringliteral">&quot;bsq&quot;</span>,        { -1, -1, -1 }, 1 }, <span class="comment">//?</span>
<a name="l00224"></a>00224                 { <span class="stringliteral">&quot;bss&quot;</span>,        { 8, -1, -1 }, 0 },
<a name="l00225"></a>00225                 { <span class="stringliteral">&quot;c&quot;</span>,          { -1, -1, -1 }, 1 }, <span class="comment">//?</span>
<a name="l00226"></a>00226                 { <span class="stringliteral">&quot;d&quot;</span>,          { 32, -1, -1 }, 0 },
<a name="l00227"></a>00227                 { <span class="stringliteral">&quot;di&quot;</span>,         { 32, -1, -1 }, 0 },
<a name="l00228"></a>00228                 { <span class="stringliteral">&quot;dq&quot;</span>,         { 128, -1, -1 }, 0 },
<a name="l00229"></a>00229                 { <span class="stringliteral">&quot;dqp&quot;</span>,        { 32, -1, 64 }, 0 },
<a name="l00230"></a>00230                 { <span class="stringliteral">&quot;dr&quot;</span>,         { 64, -1, -1 }, 0 },
<a name="l00231"></a>00231                 { <span class="stringliteral">&quot;ds&quot;</span>,         { 64, -1, -1 }, 0 },
<a name="l00232"></a>00232                 { <span class="stringliteral">&quot;e&quot;</span>,          { 16, -1, 32 }, 0 },
<a name="l00233"></a>00233                 { <span class="stringliteral">&quot;er&quot;</span>,         { 80, -1, -1 }, 0 },
<a name="l00234"></a>00234                 { <span class="stringliteral">&quot;p&quot;</span>,          { 16, -1, 32 }, 0 },
<a name="l00235"></a>00235                 { <span class="stringliteral">&quot;pi&quot;</span>,         { 64, -1, -1 }, 0 },
<a name="l00236"></a>00236                 { <span class="stringliteral">&quot;pd&quot;</span>,         { 16, -1, -1 }, 0 },
<a name="l00237"></a>00237                 { <span class="stringliteral">&quot;ps&quot;</span>,         { 128, -1, -1 }, 0 },
<a name="l00238"></a>00238                 { <span class="stringliteral">&quot;psq&quot;</span>,        { 64, -1, -1 }, 0 },
<a name="l00239"></a>00239                 { <span class="stringliteral">&quot;pt&quot;</span>,         { 80, -1, -1 }, 0 },
<a name="l00240"></a>00240                 { <span class="stringliteral">&quot;ptp&quot;</span>,        { 32, -1, 48 }, 1 }, <span class="comment">//?</span>
<a name="l00241"></a>00241                 { <span class="stringliteral">&quot;q&quot;</span>,          { 64, -1, -1 }, 0 },
<a name="l00242"></a>00242                 { <span class="stringliteral">&quot;qi&quot;</span>,         { 64, -1, -1 }, 0 },
<a name="l00243"></a>00243                 { <span class="stringliteral">&quot;qp&quot;</span>,         { 64, -1, -1 }, 0 },
<a name="l00244"></a>00244                 { <span class="stringliteral">&quot;s&quot;</span>,          { <a class="code" href="common_8h.html#a35962d72640f5d7417802c89b4eb5688" title="One byte.">BYTE</a>(6), -1, <a class="code" href="common_8h.html#a35962d72640f5d7417802c89b4eb5688" title="One byte.">BYTE</a>(10) }, 0 },
<a name="l00245"></a>00245                 { <span class="stringliteral">&quot;sd&quot;</span>,         { 128, -1, -1 }, 0 },
<a name="l00246"></a>00246                 { <span class="stringliteral">&quot;si&quot;</span>,         { -1, -1, -1 }, 1 }, <span class="comment">//?</span>
<a name="l00247"></a>00247                 { <span class="stringliteral">&quot;sr&quot;</span>,         { 32, -1, -1 }, 0 },
<a name="l00248"></a>00248                 { <span class="stringliteral">&quot;ss&quot;</span>,         { 128, -1, -1 }, 0 },
<a name="l00249"></a>00249                 { <span class="stringliteral">&quot;st&quot;</span>,         { 94, -1, 108 }, 0 },
<a name="l00250"></a>00250                 { <span class="stringliteral">&quot;stx&quot;</span>,        { 512, -1, -1 }, 0 },
<a name="l00251"></a>00251                 { <span class="stringliteral">&quot;t&quot;</span>,          { <a class="code" href="common_8h.html#a35962d72640f5d7417802c89b4eb5688" title="One byte.">BYTE</a>(10), -1, -1 }, 0 },
<a name="l00252"></a>00252                 { <span class="stringliteral">&quot;v&quot;</span>,          { 16, -1, 32 }, 1 }, <span class="comment">//? OP SIZE ATRRB</span>
<a name="l00253"></a>00253                 <span class="comment">//{ &quot;vds&quot;,      { 16, -1, 32 }, 0 },</span>
<a name="l00254"></a>00254                 { <span class="stringliteral">&quot;vds&quot;</span>,        { 32, -1, 64 }, 0 },
<a name="l00255"></a>00255                 { <span class="stringliteral">&quot;vq&quot;</span>,         { 64, -1, 16 }, 0 },
<a name="l00256"></a>00256                 { <span class="stringliteral">&quot;vqp&quot;</span>,        { 32, 16, 64 }, 0 }, <span class="comment">// complete</span>
<a name="l00257"></a>00257                 { <span class="stringliteral">&quot;vs&quot;</span>,         { 16, -1, 32 }, 0 },
<a name="l00258"></a>00258                 { <span class="stringliteral">&quot;w&quot;</span>,          { 16, -1, -1 }, 0 },
<a name="l00259"></a>00259                 { <span class="stringliteral">&quot;wi&quot;</span>,         { 16, -1, -1 }, 0 },
<a name="l00260"></a>00260                 { <span class="stringliteral">&quot;\0&quot;</span>,         { 16, -1, -1 }, 0 }
<a name="l00261"></a>00261 };
<a name="l00267"></a><a class="code" href="decode_8c.html#aa1cc69f916419120ea6e64ad9255ade5">00267</a> <a class="code" href="struct__reg__values.html" title="Structure containing the attributes of the different types of records.">REG_VALUES</a>* <a class="code" href="decode_8c.html#aa1cc69f916419120ea6e64ad9255ade5" title="Gets the corresponding register according the value and size.">getRegister</a>(<a class="code" href="common_8h.html#ad8ce12d83f204245685f98caf9d03944" title="One byte.">UINT8</a> value, <a class="code" href="common_8h.html#ad8ce12d83f204245685f98caf9d03944" title="One byte.">UINT8</a> <a class="code" href="my_obj_dump_8c.html#a1e1268d164c38e4f8a4f4eb9058b0601" title="File size.">size</a>)
<a name="l00268"></a>00268 {
<a name="l00269"></a>00269         <span class="comment">//search for the register</span>
<a name="l00270"></a>00270         <a class="code" href="struct__reg__values.html" title="Structure containing the attributes of the different types of records.">REG_VALUES</a> * regPtr;
<a name="l00271"></a>00271         regPtr = <a class="code" href="decode_8c.html#a2c6bbca72cf3a579cdad52052a3ab14e" title="Array containing the different record types according to their size.">reg_values_list</a>;
<a name="l00272"></a>00272         <span class="keywordflow">while</span> (regPtr-&gt;<a class="code" href="struct__reg__values.html#aed1cfb225a5fb77461e7972691e68a72" title="Register name.">string</a> != <span class="charliteral">&#39;\0&#39;</span>)
<a name="l00273"></a>00273         {
<a name="l00274"></a>00274                 <span class="keywordflow">if</span> ((regPtr-&gt;<a class="code" href="struct__reg__values.html#ac049c6b79f4df8aba1cdcf7d6ffcc143" title="Register value.">regValue</a> == value) &amp;&amp;
<a name="l00275"></a>00275                     (regPtr-&gt;<a class="code" href="struct__reg__values.html#a848a04833b6c878ad53ada74dc560c8f" title="Register size.">size</a> == size))
<a name="l00276"></a>00276                 {
<a name="l00277"></a>00277                         <span class="keywordflow">return</span> regPtr;
<a name="l00278"></a>00278                 }
<a name="l00279"></a>00279                 regPtr++;
<a name="l00280"></a>00280         }
<a name="l00281"></a>00281         <span class="keywordflow">return</span> (<a class="code" href="struct__reg__values.html" title="Structure containing the attributes of the different types of records.">REG_VALUES</a>*)0;
<a name="l00282"></a>00282 }
<a name="l00288"></a><a class="code" href="decode_8c.html#a8a02f8d66e234d84ae58c1716bd928c2">00288</a> <span class="keywordtype">char</span> <a class="code" href="decode_8c.html#a8a02f8d66e234d84ae58c1716bd928c2" title="Gets the operand size according to the operation type and addressing method.">getSizeOfOperand</a>(<a class="code" href="common_8h.html#a7e125472d65b57f10905accbed140b99" title="Stores 8 bits.">INT8</a> * opType, <a class="code" href="common_8h.html#a7e125472d65b57f10905accbed140b99" title="Stores 8 bits.">INT8</a> * opAddrMode)
<a name="l00289"></a>00289 {
<a name="l00290"></a>00290 
<a name="l00291"></a>00291         <a class="code" href="structs___addressing_method.html" title="Structure containing the Addressing method of an operation.">s_AddressingMethod</a> * aPtr = <a class="code" href="decode_8c.html#a815b93624003eeec418bd4d3da2bf2ef" title="Array of addressing methods available.">AddresingMethodList</a>;
<a name="l00292"></a>00292         <a class="code" href="struct_c_o_d_e___f_o_r___o_p___t_y_p_e.html" title="Structure containing the code and size of an operation according its type.">CODE_FOR_OP_TYPE</a> * oPtr = <a class="code" href="decode_8c.html#ab9dafaeb644341185d2545f64b1b8d65" title="Array containing the attributes of the different operand types.">operandTypeCodes</a>;
<a name="l00293"></a>00293 
<a name="l00294"></a>00294         <span class="keywordflow">while</span> (aPtr-&gt;<a class="code" href="structs___addressing_method.html#a4d58f38b3056254422336aef75298811" title="Operation code.">coder</a> != 0)
<a name="l00295"></a>00295         {
<a name="l00296"></a>00296                 <span class="keywordflow">if</span> (strcmp(aPtr-&gt;<a class="code" href="structs___addressing_method.html#a4d58f38b3056254422336aef75298811" title="Operation code.">coder</a>, opAddrMode) == 0)
<a name="l00297"></a>00297                 {
<a name="l00298"></a>00298                         <span class="keywordflow">break</span>;
<a name="l00299"></a>00299                 }
<a name="l00300"></a>00300                 aPtr++;
<a name="l00301"></a>00301         }
<a name="l00302"></a>00302 
<a name="l00303"></a>00303         <span class="keywordflow">while</span> (oPtr-&gt;<a class="code" href="struct_c_o_d_e___f_o_r___o_p___t_y_p_e.html#a4facf4f9894d67cc979d8e5a03ea24b3" title="Operation code.">code</a>[0] !=<span class="charliteral">&#39;\0&#39;</span>)
<a name="l00304"></a>00304         {
<a name="l00305"></a>00305                 <span class="keywordflow">if</span> (strcmp(oPtr-&gt;<a class="code" href="struct_c_o_d_e___f_o_r___o_p___t_y_p_e.html#a4facf4f9894d67cc979d8e5a03ea24b3" title="Operation code.">code</a>, opType) == 0)
<a name="l00306"></a>00306                 {
<a name="l00307"></a>00307                         <span class="keywordflow">if</span> (oPtr-&gt;<a class="code" href="struct_c_o_d_e___f_o_r___o_p___t_y_p_e.html#a8bab6aa7cec12da5156fcc0b5bed4993">wtf</a>)
<a name="l00308"></a>00308                         {
<a name="l00309"></a>00309                                 <a class="code" href="debug_8h.html#a1b7e26bb727a722ca100ed856b4e1d98" title="Print Debug.">PRINT_DEBUG</a>(<a class="code" href="debug_8h.html#a41d588ee907c299c7a790964deeef02d" title="Debug all process.">DEBUG_ALL</a>,<span class="stringliteral">&quot;WARNING attribute unknown found: %s\n&quot;</span>,oPtr-&gt;<a class="code" href="struct_c_o_d_e___f_o_r___o_p___t_y_p_e.html#a4facf4f9894d67cc979d8e5a03ea24b3" title="Operation code.">code</a>);
<a name="l00310"></a>00310                         }
<a name="l00311"></a>00311 
<a name="l00312"></a>00312                         <span class="keywordflow">if</span> (aPtr-&gt;<a class="code" href="structs___addressing_method.html#af26aab29c7050e74dc537fb2ff88f34a" title="Size of ModReg register.">isSizeInModreg</a>)<span class="comment">//Operand is in modReg</span>
<a name="l00313"></a>00313                         {
<a name="l00314"></a>00314                                 <span class="keywordflow">return</span> aPtr-&gt;<a class="code" href="structs___addressing_method.html#a287348bf234d6dd4a62e7a726c6ad4cf" title="Size of addressing.">sizeOfAddressing</a>;
<a name="l00315"></a>00315                         }
<a name="l00316"></a>00316                         <span class="keywordflow">else</span>
<a name="l00317"></a>00317                         {
<a name="l00318"></a>00318                                 <span class="keywordflow">if</span> (oPtr-&gt;<a class="code" href="struct_c_o_d_e___f_o_r___o_p___t_y_p_e.html#a0f4fd87469412eb48c120bd1492f7b85" title="Size in bytes.">size</a>[decodeMachine.<a class="code" href="structs__decoding.html#a880d1b1b640377a292875a48b891f759" title="Prefix Size.">prefixSizeOverride</a>] == -1)
<a name="l00319"></a>00319                                 {
<a name="l00320"></a>00320                                         <span class="keywordflow">return</span> oPtr-&gt;<a class="code" href="struct_c_o_d_e___f_o_r___o_p___t_y_p_e.html#a0f4fd87469412eb48c120bd1492f7b85" title="Size in bytes.">size</a>[0];
<a name="l00321"></a>00321                                 }
<a name="l00322"></a>00322                                 <span class="keywordflow">else</span>
<a name="l00323"></a>00323                                 {
<a name="l00324"></a>00324                                         <span class="keywordflow">return</span> oPtr-&gt;<a class="code" href="struct_c_o_d_e___f_o_r___o_p___t_y_p_e.html#a0f4fd87469412eb48c120bd1492f7b85" title="Size in bytes.">size</a>[decodeMachine.<a class="code" href="structs__decoding.html#a880d1b1b640377a292875a48b891f759" title="Prefix Size.">prefixSizeOverride</a>];
<a name="l00325"></a>00325                                 }
<a name="l00326"></a>00326                         }
<a name="l00327"></a>00327                 }
<a name="l00328"></a>00328                 oPtr++;
<a name="l00329"></a>00329         }
<a name="l00330"></a>00330 
<a name="l00331"></a>00331         <span class="keywordflow">return</span> -1;
<a name="l00332"></a>00332 }
<a name="l00338"></a><a class="code" href="decode_8c.html#aefac88ccd9dc9f4fb1f79dcdee540c2e">00338</a> <span class="keywordtype">char</span> <a class="code" href="decode_8c.html#aefac88ccd9dc9f4fb1f79dcdee540c2e" title="Verify in the instruction has extensions.">hasExntesion</a>(<span class="keywordtype">char</span> byte, <span class="keywordtype">char</span> *list)
<a name="l00339"></a>00339 {
<a name="l00340"></a>00340         <span class="keywordtype">char</span> * pt = list;
<a name="l00341"></a>00341         <span class="keywordflow">while</span> (*pt)
<a name="l00342"></a>00342         {
<a name="l00343"></a>00343                 <span class="keywordflow">if</span> (byte &gt;= *pt &amp;&amp; byte &lt;= (*pt + 7))
<a name="l00344"></a>00344                 {
<a name="l00345"></a>00345                         <span class="keywordflow">return</span> 1;
<a name="l00346"></a>00346                 }
<a name="l00347"></a>00347                 pt++;
<a name="l00348"></a>00348         }
<a name="l00349"></a>00349         <span class="keywordflow">return</span> 0;
<a name="l00350"></a>00350 }
<a name="l00355"></a><a class="code" href="decode_8c.html#a7771adca38a9f9707ddbb29664038945">00355</a> <span class="keywordtype">char</span> <a class="code" href="decode_8c.html#a7771adca38a9f9707ddbb29664038945" title="Gets the instruction size according to the attribute analysis.">getSizeOfInstruction</a>(<a class="code" href="common_8h.html#a7e125472d65b57f10905accbed140b99" title="Stores 8 bits.">INT8</a> * buf)
<a name="l00356"></a>00356 {
<a name="l00357"></a>00357 
<a name="l00358"></a>00358         <a class="code" href="common_8h.html#ad8ce12d83f204245685f98caf9d03944" title="One byte.">UINT8</a> opIndex = 0;
<a name="l00359"></a>00359         <a class="code" href="common_8h.html#a69afa2e50b905f4eab1f2df8a3fd9f23" title="One instruction.">UINT32</a> <a class="code" href="my_obj_dump_8c.html#a1e1268d164c38e4f8a4f4eb9058b0601" title="File size.">size</a> = 0; <span class="comment">//size in bits</span>
<a name="l00360"></a>00360         <a class="code" href="common_8h.html#a7e125472d65b57f10905accbed140b99" title="Stores 8 bits.">INT8</a> *opValPtr;
<a name="l00361"></a>00361         opValPtr = buf;
<a name="l00362"></a>00362 
<a name="l00363"></a>00363         opValPtr++;<span class="comment">//Jump opcode</span>
<a name="l00364"></a>00364 
<a name="l00365"></a>00365         <span class="comment">//</span>
<a name="l00366"></a>00366         <span class="comment">//Get the number of operands in the instruction</span>
<a name="l00367"></a>00367         <span class="comment">//</span>
<a name="l00368"></a>00368         <span class="keywordflow">while</span> (*decodeMachine.<a class="code" href="structs__decoding.html#a6c806f90f6c4ce6c5dd5e0dc786b40e8" title="Opcode properties.">opProperties</a>.<a class="code" href="struct_o_p_c_o_d_e___p_r_o_p_e_r_t_i_e_s.html#a15d4fa32d95f297a491a56c9398b419d" title="Addressing method.">operand_at</a>[opIndex].<a class="code" href="struct__addresing_and_type.html#a862599f1889ae51550769f8605615625" title="Operand Type.">t</a> != 0)
<a name="l00369"></a>00369         {
<a name="l00370"></a>00370                 <a class="code" href="common_8h.html#ad8ce12d83f204245685f98caf9d03944" title="One byte.">UINT8</a> tempSize = <a class="code" href="decode_8c.html#a8a02f8d66e234d84ae58c1716bd928c2" title="Gets the operand size according to the operation type and addressing method.">getSizeOfOperand</a>(      decodeMachine.<a class="code" href="structs__decoding.html#a6c806f90f6c4ce6c5dd5e0dc786b40e8" title="Opcode properties.">opProperties</a>.<a class="code" href="struct_o_p_c_o_d_e___p_r_o_p_e_r_t_i_e_s.html#a15d4fa32d95f297a491a56c9398b419d" title="Addressing method.">operand_at</a>[opIndex].<a class="code" href="struct__addresing_and_type.html#a862599f1889ae51550769f8605615625" title="Operand Type.">t</a>,
<a name="l00371"></a>00371                                                         decodeMachine.<a class="code" href="structs__decoding.html#a6c806f90f6c4ce6c5dd5e0dc786b40e8" title="Opcode properties.">opProperties</a>.<a class="code" href="struct_o_p_c_o_d_e___p_r_o_p_e_r_t_i_e_s.html#a15d4fa32d95f297a491a56c9398b419d" title="Addressing method.">operand_at</a>[opIndex].<a class="code" href="struct__addresing_and_type.html#a675718a27aa9afcb2091cb80e6605667" title="Addressing Method.">a</a>);
<a name="l00372"></a>00372 
<a name="l00373"></a>00373                 <span class="keywordflow">if</span> (tempSize&gt; 0)
<a name="l00374"></a>00374                 {
<a name="l00375"></a>00375                         size += tempSize;
<a name="l00376"></a>00376 
<a name="l00377"></a>00377                         <span class="keywordflow">if</span>(tempSize &gt; 4) <span class="comment">//No mod reg in this operand</span>
<a name="l00378"></a>00378                         {
<a name="l00379"></a>00379                                 decodeMachine.<a class="code" href="structs__decoding.html#a2fd6616fee4654330b5c7b15da7b7352" title="Instruction decoded.">instructionDecoded</a>.<a class="code" href="struct___machine_inst_format.html#a31057fc58f4b612b1619cbb4f3c4b979" title="If it is an operation code valid.">opValid</a>[opIndex] = 1;
<a name="l00380"></a>00380                                 decodeMachine.<a class="code" href="structs__decoding.html#a2fd6616fee4654330b5c7b15da7b7352" title="Instruction decoded.">instructionDecoded</a>.<a class="code" href="struct___machine_inst_format.html#a677fc789ef02b6679c3ed09d452b91b4" title="Operation Code Size.">opSize</a>[opIndex] = tempSize;
<a name="l00381"></a>00381                                 memcpy(&amp;decodeMachine.<a class="code" href="structs__decoding.html#a2fd6616fee4654330b5c7b15da7b7352" title="Instruction decoded.">instructionDecoded</a>.<a class="code" href="struct___machine_inst_format.html#a4eb58e92677c4abf81b67f89d36b3b3d" title="Operation Code.">op</a>[opIndex][0], opValPtr, <a class="code" href="common_8h.html#a4aa5e2926d1ef8bcce281e0eab30025a" title="One byte in binary.">BIT2BYTE</a>(tempSize));
<a name="l00382"></a>00382                         }
<a name="l00383"></a>00383                         <span class="keywordflow">else</span>
<a name="l00384"></a>00384                         {
<a name="l00385"></a>00385                                 decodeMachine.<a class="code" href="structs__decoding.html#a2fd6616fee4654330b5c7b15da7b7352" title="Instruction decoded.">instructionDecoded</a>.<a class="code" href="struct___machine_inst_format.html#ab59debee789b0be0ca71811fe2b5080f">mod_reg_rm</a>.<a class="code" href="union__mod__reg.html#a537893029f1863ac865b24ec727c24b8">value</a> = buf[1];
<a name="l00386"></a>00386 
<a name="l00387"></a>00387                                 <a class="code" href="struct__reg__values.html" title="Structure containing the attributes of the different types of records.">REG_VALUES</a> * regPtr;
<a name="l00388"></a>00388                                 decodeMachine.<a class="code" href="structs__decoding.html#a2fd6616fee4654330b5c7b15da7b7352" title="Instruction decoded.">instructionDecoded</a>.<a class="code" href="struct___machine_inst_format.html#af2c2ded7b07967b789041120b1ab496e">regOpValid</a>[decodeMachine.<a class="code" href="structs__decoding.html#a3c98d1c15bde6abca6b21ed1e3e40949">modRegRegisterNumber</a>] = 1;
<a name="l00389"></a>00389                                 <a class="code" href="common_8h.html#ad8ce12d83f204245685f98caf9d03944" title="One byte.">UINT8</a> tempRegRMVal = decodeMachine.<a class="code" href="structs__decoding.html#a3c98d1c15bde6abca6b21ed1e3e40949">modRegRegisterNumber</a>?decodeMachine.<a class="code" href="structs__decoding.html#a2fd6616fee4654330b5c7b15da7b7352" title="Instruction decoded.">instructionDecoded</a>.<a class="code" href="struct___machine_inst_format.html#ab59debee789b0be0ca71811fe2b5080f">mod_reg_rm</a>.<a class="code" href="union__mod__reg.html#a110b5552af2d9555ad3238844f9b26a2">reg_opcode</a>:
<a name="l00390"></a>00390                                                                                                                                                 decodeMachine.<a class="code" href="structs__decoding.html#a2fd6616fee4654330b5c7b15da7b7352" title="Instruction decoded.">instructionDecoded</a>.<a class="code" href="struct___machine_inst_format.html#ab59debee789b0be0ca71811fe2b5080f">mod_reg_rm</a>.<a class="code" href="union__mod__reg.html#a4a1a64b628601eed4a2bf13d517bcba3">rm</a>;
<a name="l00391"></a>00391                                 regPtr = <a class="code" href="decode_8c.html#aa1cc69f916419120ea6e64ad9255ade5" title="Gets the corresponding register according the value and size.">getRegister</a>(tempRegRMVal , 32);
<a name="l00392"></a>00392                                 memcpy( decodeMachine.<a class="code" href="structs__decoding.html#a2fd6616fee4654330b5c7b15da7b7352" title="Instruction decoded.">instructionDecoded</a>.<a class="code" href="struct___machine_inst_format.html#ad584458f2e8f530ffd6b90449da4c915">regOpp</a>[decodeMachine.<a class="code" href="structs__decoding.html#a3c98d1c15bde6abca6b21ed1e3e40949">modRegRegisterNumber</a>],
<a name="l00393"></a>00393                                                 regPtr-&gt;<a class="code" href="struct__reg__values.html#aed1cfb225a5fb77461e7972691e68a72" title="Register name.">string</a>,
<a name="l00394"></a>00394                                                 3);
<a name="l00395"></a>00395                                 decodeMachine.<a class="code" href="structs__decoding.html#a3c98d1c15bde6abca6b21ed1e3e40949">modRegRegisterNumber</a>++;
<a name="l00396"></a>00396 
<a name="l00397"></a>00397                                 decodeMachine.<a class="code" href="structs__decoding.html#a2fd6616fee4654330b5c7b15da7b7352" title="Instruction decoded.">instructionDecoded</a>.<a class="code" href="struct___machine_inst_format.html#af2cf9d902e06474e4cbcf47c1cdc6bfc" title="If it is a ModReg register.">isModeReg</a> = 1;
<a name="l00398"></a>00398                                 opValPtr++;
<a name="l00399"></a>00399                                 <span class="comment">//decodeMachine.isModReg = 1;</span>
<a name="l00400"></a>00400                         }
<a name="l00401"></a>00401 
<a name="l00402"></a>00402                 }
<a name="l00403"></a>00403                 opIndex++;
<a name="l00404"></a>00404         }
<a name="l00405"></a>00405 
<a name="l00406"></a>00406         <span class="comment">//Add the length of the opcode</span>
<a name="l00407"></a>00407         size += 8;
<a name="l00408"></a>00408         <span class="keywordflow">return</span> <a class="code" href="my_obj_dump_8c.html#a1e1268d164c38e4f8a4f4eb9058b0601" title="File size.">size</a>;
<a name="l00409"></a>00409 
<a name="l00410"></a>00410 }
<a name="l00415"></a><a class="code" href="decode_8c.html#a820c8ac2db0636187c27ec47f668bed4">00415</a> <span class="keywordtype">char</span> <a class="code" href="decode_8c.html#a820c8ac2db0636187c27ec47f668bed4" title="Process that analyzes and disassembles instructions with one byte opcode.">decodeOneByteOpcode</a>(<span class="keywordtype">char</span>* buf)
<a name="l00416"></a>00416 {
<a name="l00417"></a>00417         <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> temp;
<a name="l00418"></a>00418         temp = (<span class="keywordtype">unsigned</span> char) buf[0];
<a name="l00419"></a>00419 
<a name="l00420"></a>00420         <span class="keywordflow">if</span> (<a class="code" href="decode_8c.html#aefac88ccd9dc9f4fb1f79dcdee540c2e" title="Verify in the instruction has extensions.">hasExntesion</a>(buf[0], <a class="code" href="decode_8c.html#a29379ff4587818005d5ef90dae5bd1e8" title="Array containing one byte instruction codes.">OneByteExtensionInstructions</a>))
<a name="l00421"></a>00421         {
<a name="l00422"></a>00422                 temp &amp;= 0xf8;   <span class="comment">//Clear 3 lsb</span>
<a name="l00423"></a>00423                 <a class="code" href="struct__reg__values.html" title="Structure containing the attributes of the different types of records.">REG_VALUES</a> * regPtr;
<a name="l00424"></a>00424                 regPtr = <a class="code" href="decode_8c.html#aa1cc69f916419120ea6e64ad9255ade5" title="Gets the corresponding register according the value and size.">getRegister</a>((buf[0] &amp; 0x07), 32);
<a name="l00425"></a>00425                 decodeMachine.<a class="code" href="structs__decoding.html#a2fd6616fee4654330b5c7b15da7b7352" title="Instruction decoded.">instructionDecoded</a>.<a class="code" href="struct___machine_inst_format.html#af2c2ded7b07967b789041120b1ab496e">regOpValid</a>[0] = 1;
<a name="l00426"></a>00426                 decodeMachine.<a class="code" href="structs__decoding.html#a3c98d1c15bde6abca6b21ed1e3e40949">modRegRegisterNumber</a>++;
<a name="l00427"></a>00427                 memcpy(decodeMachine.<a class="code" href="structs__decoding.html#a2fd6616fee4654330b5c7b15da7b7352" title="Instruction decoded.">instructionDecoded</a>.<a class="code" href="struct___machine_inst_format.html#ad584458f2e8f530ffd6b90449da4c915">regOpp</a>[0], regPtr-&gt;<a class="code" href="struct__reg__values.html#aed1cfb225a5fb77461e7972691e68a72" title="Register name.">string</a>, 3);
<a name="l00428"></a>00428         }
<a name="l00429"></a>00429 
<a name="l00430"></a>00430         <span class="keywordflow">if</span> (<a class="code" href="ins_parser_8c.html#a646d5146e8d5bc747c229cee747b358b">findOneByteOpcode</a>(temp) == <a class="code" href="debug_8h.html#ae56fdb340b23940f7a64ed2e37c1774a" title="Response code when a process has performed an error in its execution.">STATUS_SUCCESS</a>)
<a name="l00431"></a>00431         {
<a name="l00432"></a>00432                 <a class="code" href="ins_parser_8c.html#a2f37aa58429f6120d0071cd8148db6c1">getOpcodeAtributes</a>(temp, &amp;decodeMachine.<a class="code" href="structs__decoding.html#a6c806f90f6c4ce6c5dd5e0dc786b40e8" title="Opcode properties.">opProperties</a>);
<a name="l00433"></a>00433 
<a name="l00434"></a>00434                 decodeMachine.<a class="code" href="structs__decoding.html#a0afda97449e846ad8ced20300d67fe85" title="Instruction size.">instructionSize</a> += <a class="code" href="decode_8c.html#a7771adca38a9f9707ddbb29664038945" title="Gets the instruction size according to the attribute analysis.">getSizeOfInstruction</a>(buf);
<a name="l00435"></a>00435 
<a name="l00436"></a>00436                 <a class="code" href="debug_8h.html#a1b7e26bb727a722ca100ed856b4e1d98" title="Print Debug.">PRINT_DEBUG</a>(<a class="code" href="debug_8h.html#a41d588ee907c299c7a790964deeef02d" title="Debug all process.">DEBUG_ALL</a>,<span class="stringliteral">&quot;Mnemonic: %s\n&quot;</span>,decodeMachine.<a class="code" href="structs__decoding.html#a6c806f90f6c4ce6c5dd5e0dc786b40e8" title="Opcode properties.">opProperties</a>.<a class="code" href="struct_o_p_c_o_d_e___p_r_o_p_e_r_t_i_e_s.html#a9e072a07f80500964b1d604b5ee75862" title="mnemonic">mnemonic</a>);
<a name="l00437"></a>00437                 decodeMachine.<a class="code" href="structs__decoding.html#a2fd6616fee4654330b5c7b15da7b7352" title="Instruction decoded.">instructionDecoded</a>.<a class="code" href="struct___machine_inst_format.html#afb7ad97a332968900eaa5c855884032b" title="Operation Code.">opcode</a>.<a class="code" href="union__opcode.html#a537893029f1863ac865b24ec727c24b8" title="Operation code value.">value</a> = buf[0];
<a name="l00438"></a>00438 
<a name="l00439"></a>00439                 strcpy(decodeMachine.<a class="code" href="structs__decoding.html#a2fd6616fee4654330b5c7b15da7b7352" title="Instruction decoded.">instructionDecoded</a>.<a class="code" href="struct___machine_inst_format.html#a6828a502ed446152add8bca7a42d0d09" title="mnemonic">mnemonic</a>, decodeMachine.<a class="code" href="structs__decoding.html#a6c806f90f6c4ce6c5dd5e0dc786b40e8" title="Opcode properties.">opProperties</a>.<a class="code" href="struct_o_p_c_o_d_e___p_r_o_p_e_r_t_i_e_s.html#a9e072a07f80500964b1d604b5ee75862" title="mnemonic">mnemonic</a>);
<a name="l00440"></a>00440 
<a name="l00441"></a>00441                 <a class="code" href="debug_8h.html#a1b7e26bb727a722ca100ed856b4e1d98" title="Print Debug.">PRINT_DEBUG</a>(<a class="code" href="debug_8h.html#a41d588ee907c299c7a790964deeef02d" title="Debug all process.">DEBUG_ALL</a>,<span class="stringliteral">&quot;Instruction size: %d bytes\n&quot;</span>,<a class="code" href="common_8h.html#a4aa5e2926d1ef8bcce281e0eab30025a" title="One byte in binary.">BIT2BYTE</a>(decodeMachine.<a class="code" href="structs__decoding.html#a0afda97449e846ad8ced20300d67fe85" title="Instruction size.">instructionSize</a>));
<a name="l00442"></a>00442 
<a name="l00443"></a>00443                 <a class="code" href="decode_8c.html#a419f00430cb5dcfe8a8955ae1635d448" title="The system is prepared to analyze the NEXT instruction.">prepareForNextInstruction</a>();
<a name="l00444"></a>00444 
<a name="l00445"></a>00445                 <span class="keywordflow">return</span> <a class="code" href="debug_8h.html#ae56fdb340b23940f7a64ed2e37c1774a" title="Response code when a process has performed an error in its execution.">STATUS_SUCCESS</a>;
<a name="l00446"></a>00446         }
<a name="l00447"></a>00447         <span class="keywordflow">else</span>
<a name="l00448"></a>00448         {
<a name="l00449"></a>00449                 <a class="code" href="debug_8c.html#a8ded31085b483d44dbeb3adbecd2debf" title="Displays the error message.">PRINT_ERROR</a>(<span class="stringliteral">&quot;Opcode not found\n&quot;</span>);
<a name="l00450"></a>00450                 <span class="keywordflow">return</span> <a class="code" href="debug_8h.html#ae4a97f0d170bc8dc771aac6c4f38ad1d" title="Response code when a process was run efficiently.">STATUS_ERROR</a>;
<a name="l00451"></a>00451         }
<a name="l00452"></a>00452 
<a name="l00453"></a>00453         <span class="keywordflow">return</span> <a class="code" href="debug_8h.html#ae4a97f0d170bc8dc771aac6c4f38ad1d" title="Response code when a process was run efficiently.">STATUS_ERROR</a>;
<a name="l00454"></a>00454 }
<a name="l00459"></a><a class="code" href="decode_8c.html#a312a131cc979ec89426f810e3faf0d94">00459</a> <span class="keywordtype">char</span> <a class="code" href="decode_8c.html#a312a131cc979ec89426f810e3faf0d94" title="Process that analyzes and identifies prefixes into the instruction analyzed.">decodePrefix</a>(<span class="keywordtype">char</span>* buf)
<a name="l00460"></a>00460 {
<a name="l00461"></a>00461 
<a name="l00462"></a>00462         <span class="comment">//look for prefix in prefix list</span>
<a name="l00463"></a>00463         <a class="code" href="structs___prefix_descriptor.html" title="Structure containing the prefixes to be identified within a statement.">s_PrefixDescriptor</a> *pPtr = <a class="code" href="decode_8c.html#aa93c1548ecbcf7220917fcbefb596d5e" title="Array of prefix options.">PrefixDescriptionList</a>;
<a name="l00464"></a>00464         <span class="keywordflow">while</span> (pPtr-&gt;<a class="code" href="structs___prefix_descriptor.html#acc9f4f4f6caf29069dbe5bcafd18426a" title="Prefix values.">prefixValue</a> != 0)
<a name="l00465"></a>00465         {
<a name="l00466"></a>00466                 <span class="keywordflow">if</span> (buf[0] == pPtr-&gt;<a class="code" href="structs___prefix_descriptor.html#acc9f4f4f6caf29069dbe5bcafd18426a" title="Prefix values.">prefixValue</a>)
<a name="l00467"></a>00467                 {
<a name="l00468"></a>00468                         decodeMachine.<a class="code" href="structs__decoding.html#a880d1b1b640377a292875a48b891f759" title="Prefix Size.">prefixSizeOverride</a> = pPtr-&gt;<a class="code" href="structs___prefix_descriptor.html#ac86594fb76193cdd5825e2a13c09f1bd" title="Prefix size.">size</a>;
<a name="l00469"></a>00469                         <span class="keywordflow">break</span>;
<a name="l00470"></a>00470                 }
<a name="l00471"></a>00471                 pPtr++;
<a name="l00472"></a>00472         }
<a name="l00473"></a>00473 
<a name="l00474"></a>00474         decodeMachine.<a class="code" href="structs__decoding.html#a2fd6616fee4654330b5c7b15da7b7352" title="Instruction decoded.">instructionDecoded</a>.<a class="code" href="struct___machine_inst_format.html#a53e89f0766181e3cfb8ec3b314f437ef" title="Prefix value.">isPrefix</a> = 1;
<a name="l00475"></a>00475         decodeMachine.<a class="code" href="structs__decoding.html#a2fd6616fee4654330b5c7b15da7b7352" title="Instruction decoded.">instructionDecoded</a>.<a class="code" href="struct___machine_inst_format.html#a42f928fa90cd801945bf61b59cb49e92">prefix</a>.<a class="code" href="struct__prefix.html#a537893029f1863ac865b24ec727c24b8">value</a> = buf[0];
<a name="l00476"></a>00476 
<a name="l00477"></a>00477         <a class="code" href="decode_8c.html#a434fe20f31a4c47e314f8326f6a31d21" title="Global Buffer containing the instruction to be processed.">gBuf</a>++;
<a name="l00478"></a>00478         <a class="code" href="decode_8c.html#a513933770d2ecd9754fbb67a790bdb45" title="Address to be access.">gAddress</a>++;
<a name="l00479"></a>00479         decodeMachine.<a class="code" href="structs__decoding.html#a0afda97449e846ad8ced20300d67fe85" title="Instruction size.">instructionSize</a> += 8;
<a name="l00480"></a>00480         decodeMachine.<a class="code" href="structs__decoding.html#a3ba3c977f9f59cbdb48635e69c36c1e6" title="Pointer to the next instruction.">Next</a> = <a class="code" href="decode_8c.html#af43580ec538f6fc237691eb3a926a93d" title="Function that determines the processing functionality byte.">determineByteFunction</a>;
<a name="l00481"></a>00481 
<a name="l00482"></a>00482         <span class="keywordflow">return</span> <a class="code" href="debug_8h.html#ae56fdb340b23940f7a64ed2e37c1774a" title="Response code when a process has performed an error in its execution.">STATUS_SUCCESS</a>;
<a name="l00483"></a>00483 }
<a name="l00488"></a><a class="code" href="decode_8c.html#a2baf0b2b6a468b9e08f84c32cec7ae71">00488</a> <span class="keywordtype">char</span> <a class="code" href="decode_8c.html#a2baf0b2b6a468b9e08f84c32cec7ae71" title="Process that analyzes and disassembles instructions with two byte opcode.">decodeTwoByteOpcode</a>(<span class="keywordtype">char</span>* buf)
<a name="l00489"></a>00489 {
<a name="l00490"></a>00490         <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> temp;
<a name="l00491"></a>00491         temp = (<span class="keywordtype">unsigned</span> char) buf[0];
<a name="l00492"></a>00492 
<a name="l00493"></a>00493         <span class="keywordflow">if</span> (<a class="code" href="decode_8c.html#aefac88ccd9dc9f4fb1f79dcdee540c2e" title="Verify in the instruction has extensions.">hasExntesion</a>(buf[0], <a class="code" href="decode_8c.html#a29379ff4587818005d5ef90dae5bd1e8" title="Array containing one byte instruction codes.">OneByteExtensionInstructions</a>))
<a name="l00494"></a>00494         {
<a name="l00495"></a>00495                 temp &amp;= 0xf8;   <span class="comment">//Clear 3 lsb</span>
<a name="l00496"></a>00496         }
<a name="l00497"></a>00497 
<a name="l00498"></a>00498         <span class="keywordflow">if</span> (<a class="code" href="ins_parser_8c.html#a6748a106490f6883dc5bea66a9a5db9f">findTwoByteOpcode</a>(temp) == <a class="code" href="debug_8h.html#ae56fdb340b23940f7a64ed2e37c1774a" title="Response code when a process has performed an error in its execution.">STATUS_SUCCESS</a>)
<a name="l00499"></a>00499         {
<a name="l00500"></a>00500 <span class="comment">//              decodeMachine.instructionDecoded.opcode[0].value =</span>
<a name="l00501"></a>00501 <span class="comment">//                              (unsigned char) buf[0];</span>
<a name="l00502"></a>00502                 <a class="code" href="ins_parser_8c.html#a2f37aa58429f6120d0071cd8148db6c1">getOpcodeAtributes</a>(temp, &amp;decodeMachine.<a class="code" href="structs__decoding.html#a6c806f90f6c4ce6c5dd5e0dc786b40e8" title="Opcode properties.">opProperties</a>);
<a name="l00503"></a>00503                 decodeMachine.<a class="code" href="structs__decoding.html#a0afda97449e846ad8ced20300d67fe85" title="Instruction size.">instructionSize</a> += <a class="code" href="decode_8c.html#a7771adca38a9f9707ddbb29664038945" title="Gets the instruction size according to the attribute analysis.">getSizeOfInstruction</a>(buf);
<a name="l00504"></a>00504                 <a class="code" href="debug_8h.html#a1b7e26bb727a722ca100ed856b4e1d98" title="Print Debug.">PRINT_DEBUG</a>(<a class="code" href="debug_8h.html#a41d588ee907c299c7a790964deeef02d" title="Debug all process.">DEBUG_ALL</a>,
<a name="l00505"></a>00505                                         <span class="stringliteral">&quot;Mnemonic: %s\n&quot;</span>,
<a name="l00506"></a>00506                                         decodeMachine.<a class="code" href="structs__decoding.html#a6c806f90f6c4ce6c5dd5e0dc786b40e8" title="Opcode properties.">opProperties</a>.<a class="code" href="struct_o_p_c_o_d_e___p_r_o_p_e_r_t_i_e_s.html#a9e072a07f80500964b1d604b5ee75862" title="mnemonic">mnemonic</a>);
<a name="l00507"></a>00507                 <a class="code" href="debug_8h.html#a1b7e26bb727a722ca100ed856b4e1d98" title="Print Debug.">PRINT_DEBUG</a>(<a class="code" href="debug_8h.html#a41d588ee907c299c7a790964deeef02d" title="Debug all process.">DEBUG_ALL</a>,
<a name="l00508"></a>00508                                         <span class="stringliteral">&quot;Instruction size: %d bytes\n&quot;</span>,
<a name="l00509"></a>00509                                         <a class="code" href="common_8h.html#a4aa5e2926d1ef8bcce281e0eab30025a" title="One byte in binary.">BIT2BYTE</a>(decodeMachine.<a class="code" href="structs__decoding.html#a0afda97449e846ad8ced20300d67fe85" title="Instruction size.">instructionSize</a>));
<a name="l00510"></a>00510 
<a name="l00511"></a>00511                 <span class="comment">//decodeMachine.decoded = 1; // :)</span>
<a name="l00512"></a>00512                 <a class="code" href="decode_8c.html#a419f00430cb5dcfe8a8955ae1635d448" title="The system is prepared to analyze the NEXT instruction.">prepareForNextInstruction</a>();
<a name="l00513"></a>00513 
<a name="l00514"></a>00514                 <span class="keywordflow">return</span> <a class="code" href="debug_8h.html#ae56fdb340b23940f7a64ed2e37c1774a" title="Response code when a process has performed an error in its execution.">STATUS_SUCCESS</a>;
<a name="l00515"></a>00515         }
<a name="l00516"></a>00516         <span class="keywordflow">else</span>
<a name="l00517"></a>00517         {
<a name="l00518"></a>00518                 <a class="code" href="debug_8c.html#a8ded31085b483d44dbeb3adbecd2debf" title="Displays the error message.">PRINT_ERROR</a>(<span class="stringliteral">&quot;Opcode not found\n&quot;</span>);
<a name="l00519"></a>00519                 <span class="keywordflow">return</span> <a class="code" href="debug_8h.html#ae4a97f0d170bc8dc771aac6c4f38ad1d" title="Response code when a process was run efficiently.">STATUS_ERROR</a>;
<a name="l00520"></a>00520         }
<a name="l00521"></a>00521 
<a name="l00522"></a>00522         <span class="keywordflow">return</span> <a class="code" href="debug_8h.html#ae4a97f0d170bc8dc771aac6c4f38ad1d" title="Response code when a process was run efficiently.">STATUS_ERROR</a>;
<a name="l00523"></a>00523 
<a name="l00524"></a>00524 }
<a name="l00529"></a><a class="code" href="decode_8c.html#a463b6c6d26f3cd0ec7f69dbed460681b">00529</a> <span class="keywordtype">char</span> <a class="code" href="decode_8c.html#a463b6c6d26f3cd0ec7f69dbed460681b" title="Process that analyzes and identifies if buf is a prefix.">isPrefix</a>(<a class="code" href="common_8h.html#a7e125472d65b57f10905accbed140b99" title="Stores 8 bits.">INT8</a>* buf)
<a name="l00530"></a>00530 {
<a name="l00531"></a>00531         <span class="comment">//look for prefix in prefix list</span>
<a name="l00532"></a>00532         <a class="code" href="structs___prefix_descriptor.html" title="Structure containing the prefixes to be identified within a statement.">s_PrefixDescriptor</a> *pPtr = <a class="code" href="decode_8c.html#aa93c1548ecbcf7220917fcbefb596d5e" title="Array of prefix options.">PrefixDescriptionList</a>;
<a name="l00533"></a>00533         <span class="keywordflow">while</span> (pPtr-&gt;<a class="code" href="structs___prefix_descriptor.html#acc9f4f4f6caf29069dbe5bcafd18426a" title="Prefix values.">prefixValue</a> != 0)
<a name="l00534"></a>00534         {
<a name="l00535"></a>00535                 <span class="keywordflow">if</span> (buf[0] == pPtr-&gt;<a class="code" href="structs___prefix_descriptor.html#acc9f4f4f6caf29069dbe5bcafd18426a" title="Prefix values.">prefixValue</a>)
<a name="l00536"></a>00536                 {
<a name="l00537"></a>00537                         <span class="keywordflow">return</span> 1;
<a name="l00538"></a>00538                 }
<a name="l00539"></a>00539                 pPtr++;
<a name="l00540"></a>00540         }
<a name="l00541"></a>00541 
<a name="l00542"></a>00542         <span class="keywordflow">return</span> 0;
<a name="l00543"></a>00543 }
<a name="l00548"></a><a class="code" href="decode_8c.html#af43580ec538f6fc237691eb3a926a93d">00548</a> <span class="keywordtype">char</span> <a class="code" href="decode_8c.html#af43580ec538f6fc237691eb3a926a93d" title="Function that determines the processing functionality byte.">determineByteFunction</a>(<span class="keywordtype">char</span>* buf)
<a name="l00549"></a>00549 {
<a name="l00550"></a>00550 
<a name="l00551"></a>00551         <span class="keywordflow">if</span> (buf[0] == <a class="code" href="decode_8h.html#a9b34f51c6f391e9e98cea40a041241c9">TWO_BYTE_OPCODE</a>)
<a name="l00552"></a>00552         {
<a name="l00553"></a>00553                 <span class="comment">//do something...</span>
<a name="l00554"></a>00554                 <a class="code" href="debug_8h.html#a1b7e26bb727a722ca100ed856b4e1d98" title="Print Debug.">PRINT_DEBUG</a>(<a class="code" href="debug_8h.html#a41d588ee907c299c7a790964deeef02d" title="Debug all process.">DEBUG_ALL</a>, <span class="stringliteral">&quot;Two byte opcode%c\n&quot;</span>, <span class="charliteral">&#39; &#39;</span>);
<a name="l00555"></a>00555                 <span class="comment">//decodeMachine.instructionDecoded.opcode[0].value = (unsigned char)buf[0];</span>
<a name="l00556"></a>00556                 decodeMachine.<a class="code" href="structs__decoding.html#a3ba3c977f9f59cbdb48635e69c36c1e6" title="Pointer to the next instruction.">Next</a> = <a class="code" href="decode_8c.html#a2baf0b2b6a468b9e08f84c32cec7ae71" title="Process that analyzes and disassembles instructions with two byte opcode.">decodeTwoByteOpcode</a>;
<a name="l00557"></a>00557                 <span class="keywordflow">return</span> <a class="code" href="debug_8h.html#ae56fdb340b23940f7a64ed2e37c1774a" title="Response code when a process has performed an error in its execution.">STATUS_SUCCESS</a>;
<a name="l00558"></a>00558         }
<a name="l00559"></a>00559 
<a name="l00560"></a>00560         <span class="keywordflow">if</span> (<a class="code" href="decode_8c.html#a463b6c6d26f3cd0ec7f69dbed460681b" title="Process that analyzes and identifies if buf is a prefix.">isPrefix</a>(&amp;buf[0]))
<a name="l00561"></a>00561         {
<a name="l00562"></a>00562                 <a class="code" href="debug_8h.html#a1b7e26bb727a722ca100ed856b4e1d98" title="Print Debug.">PRINT_DEBUG</a>(<a class="code" href="debug_8h.html#a41d588ee907c299c7a790964deeef02d" title="Debug all process.">DEBUG_ALL</a>, <span class="stringliteral">&quot;Prefix found %x\n&quot;</span>, buf[0]);
<a name="l00563"></a>00563                 decodeMachine.<a class="code" href="structs__decoding.html#a3ba3c977f9f59cbdb48635e69c36c1e6" title="Pointer to the next instruction.">Next</a> = <a class="code" href="decode_8c.html#a312a131cc979ec89426f810e3faf0d94" title="Process that analyzes and identifies prefixes into the instruction analyzed.">decodePrefix</a>;
<a name="l00564"></a>00564                 <span class="keywordflow">return</span> <a class="code" href="debug_8h.html#ae56fdb340b23940f7a64ed2e37c1774a" title="Response code when a process has performed an error in its execution.">STATUS_SUCCESS</a>;
<a name="l00565"></a>00565         }
<a name="l00566"></a>00566 
<a name="l00567"></a>00567         decodeMachine.<a class="code" href="structs__decoding.html#a3ba3c977f9f59cbdb48635e69c36c1e6" title="Pointer to the next instruction.">Next</a> = <a class="code" href="decode_8c.html#a820c8ac2db0636187c27ec47f668bed4" title="Process that analyzes and disassembles instructions with one byte opcode.">decodeOneByteOpcode</a>;
<a name="l00568"></a>00568 
<a name="l00569"></a>00569         <span class="keywordflow">return</span> <a class="code" href="debug_8h.html#ae56fdb340b23940f7a64ed2e37c1774a" title="Response code when a process has performed an error in its execution.">STATUS_SUCCESS</a>;
<a name="l00570"></a>00570 }
<a name="l00577"></a><a class="code" href="decode_8h.html#ad9d02712baa4494872edd1c26b3b73ee">00577</a> <span class="keywordtype">char</span> <a class="code" href="decode_8c.html#a3297beb269c3c0ed6a8e226861488785" title="State machine that controls the disassembly process.">decode</a>(<span class="keywordtype">char</span>* buf, <a class="code" href="common_8h.html#ad8ce12d83f204245685f98caf9d03944" title="One byte.">UINT8</a> *decodedSize, <a class="code" href="struct___machine_inst_format.html" title="Machine Instruction Format.">MACHINE_INSTRUCTION</a> *instructionDecoded)
<a name="l00578"></a>00578 {
<a name="l00579"></a>00579         <a class="code" href="my_lib_8c.html#ad999555d5a1145e88b750ad0fc42f8b2" title="Empty memory.">zeromem</a>(&amp;decodeMachine, <span class="keyword">sizeof</span>(<a class="code" href="structs__decoding.html" title="Structure containing information of a decoded instruction.">s_decoding</a>));
<a name="l00580"></a>00580         <a class="code" href="decode_8c.html#a434fe20f31a4c47e314f8326f6a31d21" title="Global Buffer containing the instruction to be processed.">gBuf</a> = buf;
<a name="l00581"></a>00581 
<a name="l00582"></a>00582         decodeMachine.<a class="code" href="structs__decoding.html#a3ba3c977f9f59cbdb48635e69c36c1e6" title="Pointer to the next instruction.">Next</a> = <a class="code" href="decode_8c.html#af43580ec538f6fc237691eb3a926a93d" title="Function that determines the processing functionality byte.">determineByteFunction</a>;
<a name="l00583"></a>00583 
<a name="l00584"></a>00584         <span class="keywordflow">while</span> (decodeMachine.<a class="code" href="structs__decoding.html#a3ba3c977f9f59cbdb48635e69c36c1e6" title="Pointer to the next instruction.">Next</a>)
<a name="l00585"></a>00585         {
<a name="l00586"></a>00586                 assert(decodeMachine.<a class="code" href="structs__decoding.html#a3ba3c977f9f59cbdb48635e69c36c1e6" title="Pointer to the next instruction.">Next</a>(<a class="code" href="decode_8c.html#a434fe20f31a4c47e314f8326f6a31d21" title="Global Buffer containing the instruction to be processed.">gBuf</a>)==<a class="code" href="debug_8h.html#ae56fdb340b23940f7a64ed2e37c1774a" title="Response code when a process has performed an error in its execution.">STATUS_SUCCESS</a>);
<a name="l00587"></a>00587         }
<a name="l00588"></a>00588         *decodedSize = <a class="code" href="common_8h.html#a4aa5e2926d1ef8bcce281e0eab30025a" title="One byte in binary.">BIT2BYTE</a>(decodeMachine.<a class="code" href="structs__decoding.html#a0afda97449e846ad8ced20300d67fe85" title="Instruction size.">instructionSize</a>);
<a name="l00589"></a>00589 
<a name="l00590"></a>00590         <span class="comment">//</span>
<a name="l00591"></a>00591         <span class="comment">//recover</span>
<a name="l00592"></a>00592         <span class="comment">//</span>
<a name="l00593"></a>00593         memcpy(instructionDecoded, &amp;decodeMachine.<a class="code" href="structs__decoding.html#a2fd6616fee4654330b5c7b15da7b7352" title="Instruction decoded.">instructionDecoded</a>, <span class="keyword">sizeof</span>(<a class="code" href="struct___machine_inst_format.html" title="Machine Instruction Format.">MACHINE_INSTRUCTION</a>));
<a name="l00594"></a>00594 
<a name="l00595"></a>00595         <span class="keywordflow">return</span> <a class="code" href="debug_8h.html#ae56fdb340b23940f7a64ed2e37c1774a" title="Response code when a process has performed an error in its execution.">STATUS_SUCCESS</a>;
<a name="l00596"></a>00596 }
</pre></div></div><!-- contents -->
</div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Data Structures</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Defines</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

  <div id="nav-path" class="navpath">
    <ul>
      <li class="navelem"><a class="el" href="decode_8c.html">decode.c</a>      </li>

    <li class="footer">Generated on Thu Oct 11 2012 12:28:10 for Dissasemble by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.6.1 </li>
   </ul>
 </div>


</body>
</html>
